package com.zym.init.core.annotation;

import com.zym.init.core.validator.EnumRangeValidator;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.*;

@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Constraint(validatedBy = EnumRangeValidator.class)  // 校验器
public @interface EnumRange {
    /**
     * 默认提示消息
     */
    String message() default "类型错误!";
    /**
     * 分组
     */
    Class<?>[] groups() default {};
    /**
     * 负载
     */
    Class<? extends Payload>[] payload() default {};
    /**
     * 枚举类的Class
     */
    Class<? extends Enum<?>> enumClass();
    /**
     * 校验方法
     */
    String enumValidMethod();
}